#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalEntity.h"

class LocalScene;

class PreRenderProcess : public RenderProcess
{
	DECLARE_PROCESS(PreRenderProcess)

	struct VertexPosNorUv
	{
		glm::vec3 position;
		glm::vec3 normal;
		glm::vec3 tangent;
		glm::vec3 bitangent;
		glm::vec2 uv;
	};

	struct Ubo
	{
		__declspec(align(16))
			glm::mat4 model;
		__declspec(align(16))
			glm::mat4 view;
		__declspec(align(16))
			glm::mat4 proj;
		__declspec(align(16))
			glm::mat4 prevModel;
		__declspec(align(16))
			glm::mat4 prevView;
		__declspec(align(16))
			glm::mat4 prevProj;
		__declspec(align(16))
			glm::mat4 baseProj;
		__declspec(align(16))
			glm::vec4 cameraPosition;
		__declspec(align(16))
			glm::vec4 lightPosition;
		__declspec(align(16))
			glm::vec4 lightColor;
		__declspec(align(16))
			glm::vec4 lightData;
	};

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

protected:

	LocalScene* mLocalScene;

	std::vector<LocalEntity*> mModelEntitys;



	RefCountPtr<ColorRenderTarget> mColorImage;

	RefCountPtr<ColorRenderTarget> mVelocityImage;

	RefCountPtr<DepthRenderTarget> mDepthImage;




	RefCountPtr<RHIDescriptor> mDescriptor;

	RefCountPtr<GraphicsPipeline> mPipeline;

	RefCountPtr<RHIRenderPass> mRenderPass;

	RefCountPtr<RHIFrameBuffer> mFrameBuffer;



};
